Skip to content

fix: security & correctness hardening (v2.39.0)#21

Merged
drknowhow merged 2 commits into
mainfrom
release/v2.39.0-hardening
Jun 22, 2026
Merged

fix: security & correctness hardening (v2.39.0)#21
drknowhow merged 2 commits into
mainfrom
release/v2.39.0-hardening

Conversation

@drknowhow

Copy link
Copy Markdown
Owner

Summary

A multi-agent audit of C3 surfaced a hook-enforcement bypass, several edit-ledger /
session-store data-loss races, Windows line-ending and subprocess bugs across the c3
tools, installer config-merge data-loss risks, and three Oracle security gaps. This PR
fixes all of them and bumps the release to v2.39.0.

Security

  • Oracle POST /api/config was unauthenticated — any local process could
    POST {"api_require_auth": false} to disable Discovery auth or repoint
    ollama_base_url. Now requires the Bearer token + an allowlisted key set.
  • Oracle GET /api/apikey leaked the raw token — now masked unless authenticated.
  • Oracle Discovery project_path was unvalidated — now checked against discovered
    projects.

Correctness

  • Enforcement bypass: a read-only c3_* call unlocked native Edit/Write; writes
    now require c3_edit/c3_edits/c3_agent. MultiEdit/NotebookEdit are now
    enforced + logged.
  • c3_edit preserves original line endings on Windows (was rewriting LF→CRLF) and no
    longer writes/logs on a no-op batch.
  • Edit ledger / session store: tag_edit appends under lock; log_edit locked;
    collision-resistant edit ids; sessions.json writes atomically and no longer wipes the
    catalog on a corrupt read.
  • c3_delegate(claude) fixed (was 100% broken); CLI runners decode UTF-8 + kill the
    process tree on timeout.
  • Compression/indexing: JS/TS exports indexed; per-language class rendering;
    brace-in-string read truncation fixed; file_memory lazy index lock-guarded.
  • Installer: merge_c3_block, global CLAUDE.md, and upsert_toml_section no longer
    corrupt/lose user config on re-install.
  • Plus smaller c3_read / c3_validate / c3_memory / web_security /
    context_snapshot fixes.

See CHANGELOG.md for the full list.

Testing

  • python -m pytest -q474 passed.
  • New tests: test_edit_ledger_hook.py, test_oracle_security_fixes.py,
    test_service_durability.py, plus additions to enforcement / edit-normalization /
    mcp_toml / claude_md_merge / web_security / activity_reporter suites.

Release

Merging this and pushing tag v2.39.0 triggers release.yml → build → PyPI (Trusted
Publishing) → GitHub Release.

🤖 Generated with Claude Code

drknowhow and others added 2 commits June 22, 2026 06:14
A multi-agent audit of C3 surfaced a hook-enforcement bypass, edit-ledger and
session-store data-loss races, Windows line-ending/subprocess bugs across the c3
tools, installer config-merge data-loss risks, and three Oracle security gaps.

Security:
- Oracle POST /api/config now requires the Bearer token + key allowlist (was
  unauthenticated; could disable Discovery auth or repoint ollama_base_url).
- Oracle GET /api/apikey returns a masked token unless authenticated (was leaking
  the raw token).
- Oracle Discovery project_path validated against discovered projects.

Fixed:
- Enforcement bypass: a read-only c3_* call unlocked native Edit/Write; writes now
  require c3_edit/c3_edits/c3_agent. MultiEdit/NotebookEdit are now enforced+logged.
- c3_edit preserves original line endings on Windows (was rewriting LF->CRLF) and
  no longer writes/logs on a no-op batch.
- Edit ledger: tag_edit appends under lock (was a lock-free rewrite), log_edit is
  locked, edit ids carry a random suffix; sessions.json writes atomically and no
  longer wipes the catalog on a corrupt read.
- c3_delegate(claude) fixed (tuple-unpack bug); CLI runners decode UTF-8 + kill the
  process tree on timeout.
- JS/TS exported symbols are now indexed; c3_compress renders classes per-language;
  c3_read no longer truncates on braces in strings/comments; file_memory lazy index
  is lock-guarded.
- Installer: merge_c3_block, global CLAUDE.md, and upsert_toml_section no longer
  corrupt/lose user config on re-install.
- Plus smaller c3_read/c3_validate/c3_memory/web_security/context_snapshot fixes.

All 474 tests pass; new tests added for each area.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@drknowhow drknowhow merged commit 1ebb3d2 into main Jun 22, 2026
11 checks passed
@drknowhow drknowhow deleted the release/v2.39.0-hardening branch June 22, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant